<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>{$page_title}</title>
        <script language="javascript" type="text/javascript" src="{res file=js/jquery-1.2.6.js}"></script>
        <script language="javascript" type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/common.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=DatePicker/WdatePicker.js}"></script>
        <script language="javascript" type="text/javascript" src="{lib file=ajaxfileupload.js}"></script>
        <script language="javascript" type="text/javascript" src="{res file=js/jquery.funkyUI.js}"></script>
        <script language="JavaScript" type="text/javascript" src="{res file=js/lan.js}"></script>
        <link href="template/style/css/style.css" type="text/css" rel="stylesheet" />
        <script language="javascript" type="text/javascript" src="{res file=js/select.js}"></script>
        <style>
            label.error {color:red;}
        </style>
    </head>
    <body>
 <div class="sub-body">
    <!--{include file="order.form.html"}-->
    <h3 >&nbsp;</h3>
    <h3 class="title-1 tab-frame">面料信息</h3>
    <div class="tab-frame">
        <form action="{url app=order&act=addsourcing}" id="addsourcing" method="post">
            <table align="left" cellpadding="0" cellspacing="0" class="tab-add" id="tab-color2" style="border-bottom: none;">
                <tr>
                    <th align="right" width="80">面料信息</th>
                    <td align="left" colspan="3"><label>
                            <textarea name="s_info[fabric_info]" id="fabric_info" cols="100" rows="6"></textarea>
                        </label></td>
                </tr>
                <tr>
                    <th>布行/档口</th>
                    <td align="left" colspan="3">
                    <div class="select-input">
			<input type="text" id="fabric_shop_name" class="input-2" style="width:250px;" onFocus="show_select('fabric_shop_name', 'select_txt');" onBlur="hide_select('fabric_shop_name', 'fabric_shop_id', 'select_txt');" onKeyUp="input_select(this.value, 'fabric_shop_id', event);" value="{$lang.select_pls}" />
                        <input  type="button" class="btn-2" value="新增布行" onclick="$('#fabric_shop_id').val('0');$('#fabric_shop_name').val('');AjaxAddFabricShop();return false;" id="fabricshop_add" style="margin-left:2em;"/>
                        <input type="hidden" name="s_info[item_id]" id="sourcing_item_id" value="" />
                        <input type="hidden" name="s_info[fabric_shop_id]" id="fabric_shop_id" value="0" />
                        <input type="hidden" name="order_id" value="{$order_id.order_id}" />
                        <input  type="button" class="btn-2" value="添加面料信息" onclick="add_sourcing_item();return false;" id="sourcing_add" style="margin-left:2em;"/>
                        <input  type="button" class="btn-2" value="更新面料信息" onclick="update_sourcing_item();return false;" id="sourcing_update" style="margin-left:2em;"/>
                        <!--<input  type="button" class="btn-2" value="更新列表" onclick="update_souring_list();return false;"   style="margin-left:2em;"/>-->
			<div class="select-txt" id="select_txt" style="display:none;">
				<ul>
		  			<!--{foreach from=$fabrics item=fabric_shop}-->
					<li onMouseOver="over_select(this, 'over');" onMouseOut="out_select(this);" onMouseDown="down_select(this, 'fabric_shop_name', 'fabric_shop_id', {$fabric_shop.fabric_shop_id});">{$fabric_shop.fabric_shop_name}</li>
					<!--{/foreach}-->
				</ul>
			</div>
		</div>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <div class="tab-frame">
        <script>var fabrics={$fabricjson};</script>
        <div class="tab-title-1"><span>面料信息</span></div>
        <table cellspacing="0" cellpadding="0" class="tab-add" id="sourcing_table">
            <tr bgcolor="#F4F8FA">
                <th width="60">序号</th>
                <th>面料信息</th>
                <th>布行/档口</th>
                <th nowrap="nowrap" width="130">操作</th>
            </tr>
            <!--{foreach from=$sourcing_item_list item="sl" key=k name="si"}-->
            <tr bgcolor="#F4F8FA" id="tr_sourcing_item_{$sl.item_id}" type="data">
                <td>{$smarty.foreach.si.iteration}</td>
                <td>{$sl.fabric_info}</td>
                <td>{$sl.fabric_name}</td>
                <td><input  type="button" class="btn-s-1" value="修改" onclick="edit_sourcing_item('{$sl.item_id}');"/>&nbsp;<input  type="button" class="btn-s-1" value="删除" onclick="del_sourcing_item('{$sl.item_id}');"/>&nbsp;</td>
            </tr>
            <!--{/foreach}-->
            <tr bgcolor="#F4F8FA">
                <th>附件</th>
				<td id="caigou_att">
                    <!--{foreach from=$att_list item=a}-->
                    <!--{if $a.file_type eq $atttype.caigou}-->
                    <br /><a href="{$a.file_path}">{$a.file_name}</a>
                    <a onclick="return confirm('确定删除该附件吗？')" href="index.php?app=comupload&amp;act=delete&amp;id={$a.file_id}" class="pic_del">&nbsp;</a>
                    <!--{/if}-->
                    <!--{/foreach}--></td>
                <td colspan="2" align="left"><input  type="button" class="btn-3" value="上传附件" onclick="make_upload('{$atttype.caigou}','{$order.order_id}','parent.add_caigou_att');"/></td>
            </tr>
        </table>
    </div>
    <h3 class="title-1 tab-frame">合同/制单信息</h3>
    <div class="tab-frame">
        <table cellspacing="0" cellpadding="0" class="tab-add" id="tab-color4" align="left">
            <tr>
                <th align="right" width="15%">批改意见</th>
                <td align="left" width="85%" id="pigai_att">
                    <input  type="hidden" class="btn-3" value="上传附件" onclick="make_upload('{$atttype.pigai}','{$order.order_id}','parent.add_pigai_att');"/>
                    <br />
                    <!--{foreach from=$att_list item=a}-->
                    <!--{if $a.file_type eq $atttype.pigai}-->
                    <br /><a href="{$a.file_path}">{$a.file_name}</a>
                    <a onclick="drop_file($(this), {$a.file_id});return false;" href="index.php?app=comupload&amp;act=delete&amp;id={$a.file_id}" class="pic_del">&nbsp;</a>
                    <!--{/if}-->
                    <!--{/foreach}-->
                </td>
            </tr>
            <tr>
                <th align="right" width="15%">合同信息</th>
                <td align="left" width="85%" id="hetong_att">
                    <input  type="hidden" class="btn-3" value="上传附件" onclick="make_upload('{$atttype.hetong}','{$order.order_id}','parent.add_hetong_att');"/><br />
                    <!--{foreach from=$att_list item=a}-->
                    <!--{if $a.file_type eq $atttype.hetong}-->
                    <br /><a href="{$a.file_path}">{$a.file_name}</a>
                    <a href="index.php?app=comupload&amp;act=delete&amp;id={$a.file_id}" class="pic_del" onclick="drop_file($(this), {$a.file_id});return false;">&nbsp;</a>
                    <!--{/if}-->
                    <!--{/foreach}-->
                </td>
            </tr>
            <tr>
                <th align="right" width="15%">制单信息</th>
                <td align="left" width="85%" id="zhidan_att">
                    <input  type="hidden" class="btn-3" value="上传附件" onclick="make_upload('{$atttype.zhidan}','{$order.order_id}','parent.add_zhidan_att');"/><br />
                    <!--{foreach from=$att_list item=a}-->
                    <!--{if $a.file_type eq $atttype.zhidan}-->
                    <br /><a href="{$a.file_path}">{$a.file_name}</a>
                    <a onclick="drop_file($(this), {$a.file_id});return false;" href="index.php?app=comupload&amp;act=delete&amp;id={$a.file_id}" class="pic_del">&nbsp;</a>
                    <!--{/if}-->
                    <!--{/foreach}-->
                </td>
            </tr>
            <tr>
                <th align="right" width="15%">查货信息</th>
                <td align="left" width="85%" id="chahuo_att">
                    <input  type="hidden" class="btn-3" value="上传附件" onclick="make_upload('{$atttype.chahuo}','{$order.order_id}','parent.add_chahuo_att');"/>
                    <!--{foreach from=$att_list item=a}-->
                    <!--{if $a.file_type eq $atttype.chahuo}-->
                    <br /><a href="{$a.file_path}">{$a.file_name}</a>
                    <a onclick="drop_file($(this), {$a.file_id});return false;" href="index.php?app=comupload&amp;act=delete&amp;id={$a.file_id}" class="pic_del">&nbsp;</a>
                    <!--{/if}-->
                    <!--{/foreach}-->
                </td>
            </tr>
        </table>

    </div>
    <h3 class="title-1 tab-frame">大货情况</h3>
    <div class="tab-frame">
       <div class="tab-title-1"><span>大货情况</span></div>
        <form action="{$site_url}/index.php?app=order&act=dahuo" method="post" id="dahuo_form">
            <table align="left" cellpadding="0" cellspacing="0" class="tab-add" id="tab-color5">
                <tr>
                    <th align="right" width="200">大货问题</th>
                    <td align="left" colspan="3"><textarea name="info[bulk_problem]" cols="60" rows="5" id="bulk_problem"></textarea></td>
                </tr>
                <tr>
                    <th align="right">损失或/扣款情况</th>
                    <td align="left" width="300"><textarea name="info[discount_desc]" cols="60" rows="5" id="discount_desc"></textarea></td>
                    <td align="left" width="60">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                    <td  align="left">&nbsp;</td>
                </tr>
                <tr>
                    <th align="right">是否扣款</th>
                    <td align="left" colspan="3"><label><input type="radio" name="info[is_koukuan]" value="0" checked />&nbsp;否</label>&nbsp;&nbsp;&nbsp;&nbsp;<label><input type="radio" name="info[is_koukuan]" value="1" />&nbsp;是</label></td>
                </tr>
                <tr>
                    <th align="right">扣款通知</th>
                    <td id="file_koukuan"  align="left" colspan="3">&nbsp;&nbsp;<input  type="button" class="btn-2" value="上传附件" onclick="upload_docs({$atttype.koukuan},{$order.order_id});"/><br />
                        <!--{foreach from=$att_list item=a}-->
                        <!--{if $a.file_type eq $atttype.koukuan}-->
                        <br /><a href="{$a.file_path}">{$a.file_name}</a>
                        <a onclick="drop_file($(this), {$a.file_id});return false;" href="index.php?app=comupload&amp;act=delete&amp;id={$a.file_id}" class="pic_del">&nbsp;</a>
                        <!--{/if}-->
                        <!--{/foreach}-->
                    </td>
                </tr>
                <tr>
                    <td colspan="4"><input type="hidden" name="order_id" value="{$order.order_id}" />
                        <input  type="submit" class="btn-2" name="update_order_dahuo" value="更新" id="update_order_dahuo_bt"/>&nbsp;&nbsp;
                        <p align="center"><br />
                        <!--{if $order.confirm_date>0 && $order.order_id}-->
                        确认时间{$order.confirm_date|date}
                        <!--{elseif $order.order_id}-->
                        <input  type="button" class="btn-2"  value="确认订单" id="confirm_order_bt" onclick="confirm_order('{$order.order_id}');"/>&nbsp;&nbsp;
                        <!--{/if}-->
                        <!--{if $order.status!='5' && $order.status>='2' && !$order.submit_date >0 }-->
                        <input  type="button" class="btn-2"  value="提交船货" id="submit_chuanhuo_bt" onclick="submit_chuanhuo('{$order.order_id}');"/>&nbsp;&nbsp;
                        <!--{else}--><!--{if $order.submit_date>0}-->
                         &nbsp;提交船货时间{$order.submit_date|date}<!--{/if}-->
                        <!--{/if}-->

                        <!--{if $order.cancel_date>0}-->
                        &nbsp;取消时间{$order.cancel_date|date}
                        <!--{elseif $order.order_id}-->
                        <input  type="button" class="btn-2" value="取消订单" id="cancel_order_bt" onclick="cancel_order('{$order.order_id}');"/>&nbsp;&nbsp;
                        <!--{/if}-->
						<input  type="button" class="btn-2" value="返回" onclick="history.back();"/>
                        </p>
                    </td>
                </tr>
            </table>
        </form>
       
<script language="javascript" type="text/javascript">
function drop_file(obj, id)
{
	if (confirm('确定删除该附件吗？')) {
		$.getJSON('index.php?app=comupload&act=delete&id=' + id + '&ajax=1', function(data){
			if (data.done == 'true') {
				obj.prev().prev().remove();
				obj.prev().remove();
				obj.remove();
			}
			alert(data.msg);
		});
	}
}
</script>
    </div>
    <!--{if $power['pingding']}-->
    <div class="tab-frame">
        <div class="tab-title-1"><span>主管评定</span></div>
        <form action="{$site_url}/index.php?app=order&act=pingding&id={$order.order_id}" id="pingding_form">
            <table align="left" cellpadding="0" cellspacing="0" class="tab-add" id="tab-color6">
                <tr>
                    <th>货期指标</th>
                    <td align="left"> <select name="info[del_do]" id="del_do">
                            <option value="1">OK</option>
                            <option value="2">延期</option>
                            <option value="3">工厂赔空运</option>
                            <option value="4">公司赔空运</option>
                        </select><script language="javascript" type="text/javascript">$(function(){document.getElementById('del_do').value='{$order.del_do}'});</script></td>
                    <th>金额</th>
                    <td align="left"><input name="info[del_amount]" type="text" id="del_amount" class="input-1" value="{$order.del_amount}"/></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <th>价格指标</th>
                    <td align="left"><input type="text" name="info[price_do]" id="price_do" class="input-3" /></td>
                    <th>增量</th>
                    <td align="left"><input name="info[price_increment]" type="text" id="price_increment" class="input-1" value="{$order.price_increment}"/></td>
                    <td></td>
                </tr>
                 <tr>
                    <th>大货完成</th>
                    <td align="left"><input type="text" name="info[bulk_complete]" id="bulk_complete" class="input-3" /></td>
                    <th>金额</th>
                    <td align="left"><input name="info[bulk_amount]" type="text" id="bulk_amount" class="input-1" value="{$order.bulk_amount}"/></td>
                    <td align="left"></td>
                </tr>
                <tr>
                    <th>备注</th>
                    <td align="left" colspan="3">
                        <textarea id="comment_des" cols="60" rows="6" name="info[comment_des]">{$order.comment_des}</textarea>
                        <input name="pingding" type="submit" class="btn-2" value="确定" id="pingding_bt"/>
                    </td>
                    <td align="left"></td>
                </tr>
                <tr><td colspan="5">
                        <input name="order_id" value="{$order.order_id}" type="hidden"/>
                        <!--{if $order.receive_date==0 && $order.status!='5' && $order.status>='3'}-->
                        <input  type="button" class="btn-2"   value="确认到货" id="complete_order_bt" onclick="complete_order('{$order.order_id}');"/>&nbsp;&nbsp;
                        <!--{elseif $order.receive_date>0}-->
                        &nbsp;确认到货时间{$order.receive_date|date}&nbsp;
                        <!--{/if}-->
                        
                    </td></tr>
            </table>
        </form>
        <div style="height:40px;clear:both;">&nbsp;</div>
    </div>
    <!--{/if}-->

    <script>
        var order={$order_json};
        $(
        function(){
            $.each(order,function(key,val){
                if( $('#'+key).attr('nodeName')=='INPUT' && val=='0'){
                    $('#'+key).attr('value','');
                }
                else{
                    $('#'+key).attr('value',val);
                }
            })
            $("input[name='order_id']").attr('value',order.order_id);
            brand_change(order.brand_id,order.buyer_id,order.merchandiser_id);
            <!--{if $order.sample_id>0}-->
            //$("#sample_id,#style_id,#special_id").attr('disabled','disabled');
            <!--{/if}-->
        }
    );

/*
        $('#pingding_form').bind('submit',function(){
            $('#pingding_bt').attr('disabled','disabled');
            var fdata=$(this).serialize();
            var options = {
                url:'{$site_url}/index.php?app=order&act=pingding&ajax=1&id={$order.order_id}',
                type: 'post',
                data:fdata,
                dataType :'json',
                cache:false,
                success: function(json) {
                     $('#pingding_bt').attr('disabled','');
                    if(json.done){
                        $.confirm(json.msg);
                        //$('#confirm_order_bt').attr('disabled','');
                        return;
                    }
                    else{ $.confirm(json.msg);
                       
                        return;}
                },
                error:function(r,s,e){alert(r+s+e)}
            };
            $.ajax(options);
            return false;
        });
*/
    </script>
    
<script language="JavaScript" type="text/javascript" src="{res file=js/tab_color.js}"></script>
    <div id="remsg"></div>
</div>
    </body>
</html>